# --------------------------------------------------------------------
# link:  http://bb4win.org
# email: grischka@bonbon.net
# --------------------------------------------------------------------

# makefile for example.dll / gcc (mingw)

# to compile:

# - set the PATH variable to your mingw\bin directory
# - go to the source directory
# - run: make -f makefile-gcc
#    or: make -f makefile-gcc install
#    or: make -f makefile-gcc clean

OBJ     = example.obj
BIN     = example.dll
BBLIB   = ..\..\includes\mingw\bbox.a
DEF     = ..\..\includes\mingw\bb-plugin.def
RES     =

all: install

compile: $(BIN)

# edit this to where the plugin should be copied when ready:

install: compile
	copy $(BIN) c:\bblean\plugins

clean:
	del *.obj
	del *.res
	del *.dll
	del *.tds

# --------------------------------------------------------------------
CC      = gcc.exe
CP      = g++.exe
WINDRES = windres.exe -I rc -O coff --include-dir $:

CFLAGS  = -Wall -O1 \
-fno-exceptions \
-mpreferred-stack-boundary=2 \
-fomit-frame-pointer

LIBS= $(BBLIB) -lshell32 -luser32 -lkernel32 -lgdi32 -lcomctl32 #-lstdc++

$(BIN): $(OBJ) makefile-gcc $(DEF)
	dllwrap -s --dllname=$(BIN) $(OBJ) $(LIBS) --def=$(DEF)
	dir $(BIN)


.SUFFIXES: .obj .def .exp

.cpp.obj:
	$(CP) $(CFLAGS) -fno-rtti -c $< -o $@

.c.obj:
	$(CC) $(CFLAGS) -c $< -o $@

.def.exp:
	dlltool -d $< -e $@

.rc.res:
	$(WINDRES) -i $< -o $@

# --------------------------------------------------------------------
